var mongoose=require('mongoose');
var Schema=mongoose.Schema;
var config=require('../config');
var db=mongoose.createConnection(config.db_url);
db.on('error',function(error){
    console.log(error);
});


var introSchema=new Schema({
    title:String,
    content:String,
    endEditTime:{type:Date,default:Date.now}
});
//users---对应数据库表名
var Intro=db.model('Intro',introSchema);

/**
 * 获得简介信息
 */

Intro.prototype.getIntro=function(callback){
    Intro.findOne({},function(err,data){
        callback(err,data);
    })
}

Intro.prototype.updateIntro=function(options,callback){
    Intro.update({},options,function(err){
        callback(err)
    });
}

module.exports =Intro;


